home *** CD-ROM | disk | FTP | other *** search
/ Amiga Developer CD 2.1 / Amiga Developer CD v2.1.iso / Reference / DevCon / Orlando_1993 / Devcon93.1 / AREXX / Flipper / ShowBoard.rexx < prev   
Encoding:
OS/2 REXX Batch file  |  1992-09-27  |  1.1 KB  |  52 lines

  1. /*
  2.  * ShowBoard.rexx - A Flipper REXX macro to display in ASCII the board
  3.  *
  4.  * The argument given to this script is the flipper port number.
  5.  */
  6.  
  7. PARSE ARG number
  8. number=STRIP(number)
  9.  
  10. /* Generate port name for FLIPPER */
  11. port='FLIPPER.'||number
  12.  
  13. /* Check to see if the port asked for is available */
  14. IF SHOW('p',port)>0 THEN
  15.   DO
  16.     /* Address the FLIPPER port */
  17.     ADDRESS VALUE port
  18.  
  19.     /* We get results via the RESULT variable */
  20.     OPTIONS RESULTS
  21.  
  22.     /* Get the version of Flipper */
  23.     'get about' ; PARSE VAR RESULT name version copyright
  24.     SAY name "version" version
  25.  
  26.     /* Get the current board layout */
  27.     'get board' ; board=RESULT
  28.  
  29.     /* Get the current player */
  30.     'get player' ; player=RESULT
  31.  
  32.     /* Display the results of our "investigation" */
  33.     SAY " "
  34.  
  35.     IF player=='-' THEN SAY "The game is over - No moves left"
  36.     ELSE SAY "It is player "player"'s turn"
  37.  
  38.     SAY "The current board is:"
  39.     DO loop=0 to 7
  40.       SAY RIGHT(SUBSTR(board,1+8*loop,8),30)
  41.     END
  42.  
  43.     SAY " "
  44.  
  45.   END
  46. ELSE
  47.   DO
  48.     SAY port "is not active."
  49.   END
  50.  
  51. EXIT
  52.